package com.example.demo.controller;


import com.example.demo.entity.testRedis;
import com.example.demo.model.result;
import org.apache.ibatis.annotations.Param;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;



@RestController
@RequestMapping("/rabbitmq")
public class rabbitmqController {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    private Logger logger= LoggerFactory.getLogger(getClass());

    @PostMapping("/test")
    public result test(@RequestBody testRedis testRedis){
        logger.info("正在测试rabbitmq");
        rabbitTemplate.convertAndSend("userLoginExchange","userLogin",testRedis);
        return result.success("测试rabbitmq成功");
    }

}
